<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableArticle extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article', function (Blueprint $table) {
            $table->increments('id')->comment('文章id');
            $table->string('author',64)->nullable()->comment('作者');
            $table->enum('comment_disabled',array(1,0))->default(1)->comment('评论权限');
            $table->text('content')->nullable()->comment('内容');
            $table->string('content_short',256)->nullable()->comment('概要');
            $table->dateTime('display_time')->nullable()->comment('发布时间');
            $table->string('image_uri',256)->nullable()->comment('封面图');
            $table->tinyInteger('importance', false, true)->nullable()->comment('重要性 1 2 3');
            $table->json('platforms')->nullable()->comment('站台');
            $table->string('source_uri',256)->nullable()->comment('外链');
            $table->string('title',256)->comment('标题');
            $table->enum('status',array('draft','publish'))->default('draft')->comment('状态draft:草稿箱 publish:已发布');
            $table->timestamps();
            //创建索引
//            $table->unique('email');
            $table->index('title');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article');
    }
}
